<?php

function split_tags($input) {
    $output = array();
    $temp = explode(',', $input);
    foreach ($temp as $i => $o) {
        if (trim($o) != '')
            $output[$i] = trim($o);
    }
    return $output;
}

/**
 * @author duongbq
 * date 2011 - 05 - 12
 * @param type $task_id
 * @return string 
 */
function join_tags($ticket_id) {
    $CI = & get_instance();
    $CI->load->model('ticket/ticket_tag_model');

    $output = '';
    $tags = $CI->ticket_tag_model->get_ticket_tag(array('ticket_id' => $ticket_id));

    foreach ($tags as $tag) {
        if ($output == '')
            $output = $tag->tag_name;
        else
            $output .= ', ' . $tag->tag_name;
    }
    return $output;
}


